##				##
#	module p0f	 #
##				##

from sqlite3 import dbapi2 as sqlite
import traceback
name="modP0f"
info="P0f db query tool"



def convert(ip):	
	hexn = ''.join(["%02X" % long(i) for i in ip.split('.')])
    	return long(hexn, 16)


    
def do(args):
    try:
        con=sqlite.connect("/etc/p0f/db.db.db")
        cursorlite=con.cursor()
        cursorlite.execute("select name from system where ip_addr="+str(convert(args)))
        return cursorlite.fetchone()[0]
    except:
	traceback.exc()
        return "Result not in database"
    
